/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author MrKoi
 */
public class DALTotalPageIndex extends BaseConnection{
    private static CallableStatement clbStm;
    private static ResultSet rs;
    public static int TotalPage;    

    public int getTotalPage() {
        return TotalPage;
    }

    public void setTotalPage(int TotalPage) {
        this.TotalPage = TotalPage;
    }

    static void getTotalPage(String TblName,String WhereClause,int PageSize){
        try {      
            getConnection();
            clbStm=cnn.prepareCall("{call spGetTotalPage(?,?,?)}");
            clbStm.setInt("PageSize",PageSize);              
            clbStm.setString("TableName",TblName);   
            clbStm.setString("WhereClause",WhereClause);   
            rs=clbStm.executeQuery();             
            if(rs.next()){
                TotalPage=rs.getInt("TotalPage");
            }         
            rs.close();
            clbStm.close();
            cnn.close();
        } catch (SQLException ex) {
            Logger.getLogger(DALTotalPageIndex.class.getName()).log(Level.SEVERE, null, ex);
            
        }
    }
    
}
